package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Eighth_c;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Eighth_cMapper {

    @Select({
            "select",
            "*",
            "from Eighth_c",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Eighth_c> selectByName(String oName);
    @Delete({
            "delete from Eighth_c",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);

    @Delete({
        "delete from eighth_c",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into eighth_c (hospital, type, ",
        "c_type, count)",
        "values (#{hospital,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, ",
        "#{cType,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Eighth_c record);

    int insertSelective(Eighth_c record);

    @Select({
        "select",
        "id, hospital, type, c_type, count",
        "from eighth_c",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Eighth_c selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Eighth_c record);

    @Update({
        "update eighth_c",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "type = #{type,jdbcType=VARCHAR},",
          "c_type = #{cType,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Eighth_c record);
    int insertBatch(List<Eighth_c> item);
}